package kr.saeildamil.androidstudy.ch12;

import java.util.ArrayList;

import kr.saeildamil.androidstudy.R;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;

public class ListOnly extends ListActivity {
	ArrayList<MyitemEx> arList;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		arList = new ArrayList<MyitemEx>();
		MyitemEx mi;
		mi = new MyitemEx(R.drawable.iu, "아이유");
		arList.add(mi);
		mi = new MyitemEx(R.drawable.iu, "이순신");
		arList.add(mi);
		mi = new MyitemEx(R.drawable.iu, "이지은");
		arList.add(mi);

		MyListAdapter adapter = new MyListAdapter(this, R.layout.ch12_icontext,
				arList);
		setListAdapter(adapter);
	}
	
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		Toast.makeText(this, arList.get(position).name, Toast.LENGTH_LONG).show();		
	}
}
